var mongoose = require('mongoose');

var date = new Date();
var TagSchema = new mongoose.Schema({
	name:String,
	is_nav:Boolean,
	is_show:Boolean,
	intro:String,
	order_sort:Number,
	create_time:{
		type:Date,
		default:date.getTime()
	},
	update_time:{
		type:Date,
		default:date.getTime()
	}
});

TagSchema.pre('save',function(next){
	if(this.isNew){
		this.create_time = this.update_time = date.getTime();
	}else{
		this.update_time = date.getTime();
	}

	next();
});

module.exports = TagSchema;